package logiexport.wizard;

import java.io.Serializable;
import java.lang.reflect.Constructor;

import logiexport.carrito.PanelCarrito;
import logiexport.paneles.PanelPresu;

import org.apache.wicket.extensions.wizard.Wizard;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;

public class WizardPage extends WebPage implements Serializable {
	
	
	   public <C extends Wizard> WizardPage(Class<C> wizardClass)
	    {
	        if (wizardClass == null)
	        {
	            throw new IllegalArgumentException("argument wizardClass must be not null");
	        }
	        try
	        {
	        	
	        	PanelPresu lpresu =  new PanelPresu("presupuestos");
	        	lpresu.setOutputMarkupId(true);
	    		
	        	
	        	PanelCarrito a = new PanelCarrito("PanelCarrito",lpresu);	    
	        	
	        	a.setOutputMarkupId(true);
	        	
	        	add(lpresu);
	        	
	        	//Label lpresu = new Label("presupuestos","prueba2");
	        	
	    		
	        	
	            Constructor<? extends Wizard> ctor = BuyWizard.class.getConstructor(String.class, boolean.class,PanelCarrito.class);	            	                     
	                       
	            Wizard wizard = ctor.newInstance("wizard",false,a); 
	          
	            
	            add(wizard);  	       
	            add(a);
	            
	        }
	        catch (Exception e)
	        {
	            throw new RuntimeException(e);
	        }
	    }



	
	
	

}
